-- GENERATED SPELL FOR [Perfidious Dreadlord] --


function spell0_32391(pUnit, Event) --@Carrion Swarm,n/a--
pUnit:FullCastSpellOnTarget(37624,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_32391', 2000, 1)
end

function spell1_32391(pUnit, Event) --@Mind Blast,n/a--
pUnit:FullCastSpellOnTarget(15587,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_32391', 1500, 1)
end

function spell2_32391(pUnit, Event) --@Psychic Scream,Self--
pUnit:FullCastSpellOnTarget(22884,pUnit)
pUnit:RegisterEvent('Sorts_32391', 4325, 1)
end

function Sorts_32391(pUnit, Event)
local choix_sorts_32391 = math.random(0, 2)
if choix_sorts_32391 == 0 then
pUnit:RegisterEvent('spell0_32391', 1, 1)
end
if choix_sorts_32391 == 1 then
pUnit:RegisterEvent('spell1_32391', 1, 1)
end
if choix_sorts_32391 == 2 then
pUnit:RegisterEvent('spell2_32391', 1, 1)
end
end

function mob32391_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_32391', math.random(1500, 3000), 1)
end

function mob32391_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob32391_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob32391_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(32391, 1, 'mob32391_Action')
RegisterUnitEvent(32391, 2, 'mob32391_Leave')
RegisterUnitEvent(32391, 3, 'mob32391_Kill')
RegisterUnitEvent(32391, 4, 'mob32391_Die')
